home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 17 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.4 KB

  1. Path: afep.yorku.ca!ken
  2. From: ken@yorku.ca (Kenneth Kafieh)
  3. Newsgroups: comp.std.c
  4. Subject: Re: Faster FILE subroutines in standard C?
  5. Date: 4 Jan 1996 04:48:44 GMT
  6. Organization: York University
  7. Message-ID: <4cfm7c$dot@sunburst.ccs.yorku.ca>
  8. NNTP-Posting-Host: afep.yorku.ca
  9. X-Newsreader: TIN [version 1.2 PL2]
  10.  
  11.  
  12.  
  13. --
  14. I had to resort to drastic mesures inorder to put this message here.
  15. You are currently reading my signature file.
  16. Does anybody know why the @#$! that every time 
  17. I try to post on this board, the only thing
  18. that gets posted is my @$%! sig file ?!?!
  19. while we're here I might as well post my message:
  20.  
  21. I found that I was able to get 3-4 time faster performance by using good 
  22. old ANSI C file accessing routines (like  fgets, fseek, ftell, ...etc.)
  23. instead of C++ streams (like ifstream::getline, fstream::seekg, ...etc.)
  24. I wrote the program originally in C++ (a simple little phonebook for my
  25. own use) and it took about 9 seconds to scan a 100Kb file for a 3 byte
  26. string!!!  Fed up, I rewrote it in C and voila! Now it takes 2 secs!
  27. I'm using Borland C++ v2.0.
  28.  
  29. Does that sound right?  Maybe my code was inefficiently written?
  30. I know C++ is generally slower than C but I didn't think that 
  31. file stuff would be too.   What did I do wrong? Am I missing
  32. something.  Maybe I'll post the code too, later. Has anyone
  33. else noticed this too?
  34.  
  35. Come to think of it, the coding in
  36. C was cleaner looking, too.  
  37.  
  38.  
  39. And So Until Next Time...
  40.  
  41.                 I'm Ken
  42.  
  43.